package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.domain.SuccessCode;
import com.atguigu.jxc.entity.OverflowList;
import com.atguigu.jxc.service.OverflowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("overflowListGoods")
public class OverflowController {

    @Autowired
    private OverflowService overflowService;

    @PostMapping("/save")
    public ServiceVO save(OverflowList overflowList, String overflowListGoodsStr){
        overflowService.save(overflowList,overflowListGoodsStr);
        return new ServiceVO(SuccessCode.SUCCESS_CODE, SuccessCode.SUCCESS_MESS,null);
    }

    @PostMapping("list")
    public Map<String,Object> getOverflowList(String  sTime, String  eTime){
        Map<String,Object> map = overflowService.getOverflowList(sTime,eTime);
        return map;
    }

    @PostMapping("goodsList")
    public Map<String,Object> getOverflowGoodsList(Integer overflowListId){
        Map<String,Object> map = overflowService.getOverflowGoodsList(overflowListId);
        return map;
    }


}
